<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="${basePath}/public/lib/lightbox2/2.8.1/css/lightbox.css" rel="stylesheet" type="text/css" >
<#include "lib/lib.html" />
<title>项目管理</title>
</head>
<body>
	<nav class="breadcrumb">
	 	 <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 项目管理 <span class="c-gray en">&gt;</span> 优惠券列表
		 <a  class="btn btn-success radius r mr-20"  style="line-height: 1.6em; margin-top: 3px" href="javascript:location.replace(location.href);" title="刷新">
		 <i class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<div class="pd-20 text-c">
		<div class="text-c">
			<form action="${basePath}/coupon/list.do">
				<input type="text" name="couponCode" id="couponCode" placeholder="优惠券编号" value='${map.couponCode}' style="width: 250px" class="input-text">
				<input type="text" name="couponName" id="couponName" placeholder="优惠券名称" value='${map.couponName}' style="width: 250px" class="input-text">
				状态<select  name="ccouponStatus" style="width: 150px;height: 29px;">
					<option value="">请选择</option>
					<option value="0" <#if map.ccouponStatus==0>selected</#if>>有效</option>
					<option value="1" <#if map.ccouponStatus==1>selected</#if>>过期</option>
					<option value="2" <#if map.ccouponStatus==2>selected</#if>>领完</option>
				</select>
				<button name="" id="" class="btn btn-success" type="submit"> <i class="Hui-iconfont">&#xe665;</i> 搜索 </button>
			</form>
		</div>
		<div class="cl pd-5 bg-1 bk-gray mt-20">
			<span class="l">
				<a class="btn btn-primary radius" onclick="adm_add('新增','${basePath}/coupon/goAdd.do')" href="javascript:;">
				<i class="Hui-iconfont">&#xe600;</i> 新增</a></span> <span class="r"> 
			</span>
		</div>
		<div class="mt-20">
			<div id="page" class="holder"></div>  
			<table class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">
						<th>ID</th>
						<th>优惠券编码</th>
						<th>名称</th>
						<th>有效时间</th>
						<th>价格</th>
						<th>可领个数</th>
						<th>总个数</th>
						<th>剩余个数</th>
						<th>使用类型</th>
						<th>图片</th>
						<th>状态</th>
						<th width="150">创建时间</th>
						<th width="150">操作</th>
					</tr>
				</thead>
				<tbody>
					<#if list.dataList?? && list.dataList?size gt 0>
					<#list list.dataList as dl >
						<tr class="text-c">
							<td>${dl.id!}</td>
							<td>${dl.couponCode!}</td>
							<td>${dl.couponName!}</td>
							<td>${dl.startYime?string('yyyy-MM-dd')!}-${dl.endTime?string('yyyy-MM-dd')!}</td>
							<td>${dl.couponPrice /100 !}</td>
							<td>
								<#if dl.userCount==0>
									无限制
								<#else>
									${dl.userCount!}
								</#if>
							</td>
							<td>${dl.couponCount}</td>
							<td>${dl.couponSurpluscount!}</td>
							<td>
								<#if dl.ccouponUsetype == 1>
									价格
								<#elseif dl.ccouponUsetype == 2>
									时间区
								<#else>
									无限制
								</#if>
							</td>
							<td>
								<#if dl.ccouponStatus == 0>
									有效
								<#elseif dl.ccouponStatus == 1>
									过期
								<#elseif dl.ccouponStatus == 2>
									领完
								<#else>
									无效
								</#if>
							</td>
							<td>
							<a href="${dl.couponImages!}" data-lightbox="gallery" data-title="">
							<img alt="" src="${dl.couponImages!}" height="60px" width="60px"> 
							</a>
							</td>
							<td>${dl.createTime?string('yyyy-MM-dd')}</td>
							<td class="td-manage">
								<a title="编辑" href="javascript:;" onclick="adm_edit('编辑','${basePath}/coupon/goAdd.do?id=${dl.id!}&type=1','800','500')" class="ml-5" style="text-decoration:none">编辑</a> 
								<a title="删除" href="javascript:;" onclick="adm_del(this,${dl.id!})" class="ml-5" style="text-decoration:none">删除</a>
							</td>
						</tr>
					</#list>
					</#if>
				</tbody>
			</table>
			</br>
			<div class="page_list"></div>
		</div>
	</div>
	<script type="text/javascript" src="${basePath}/public/lib/lightbox2/2.8.1/js/lightbox-plus-jquery.min.js"></script>
	<script type="text/javascript" src="${basePath}/public/lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="${basePath}/public/static/h-ui.admin/js/H-ui.admin.js"></script>
	<script type="text/javascript">
	$(function(){
	 	laypage({
	 	    cont: $('.page_list'), //容器。值支持id名、原生dom对象，jquery对象,
		    pages: ${list.endPage! }, //总页数
	 	    //skip: true, //是否开启跳页
// 	    	skin: 'molv',
	 	    groups: 10, //连续显示分页数
	 	    first: '首页', //若不显示，设置false即可
	 	    last: '尾页', //若不显示，设置false即可
	 	    curr:${list.curPage!},
	 	   	hash: true, //开启hash
	 	    skin: '#00AA91',
	 	    jump: function(obj,first){ //触发分页后的回调
// 	 	       $('.view').html('目前正在第'+ obj.curr +'页，一共有：'+ obj.pages +'页');
	 	    	if(!first){
	 	         	 window.location.href="${basePath}/coupon/list.do?curPage="+obj.curr +"&pageData="+10;
	 	    	}
	 	    }
	 	});
	 			
	});
	//添加
	function adm_add(title, url, w, h) {
		layer_show(title, url, w, h);
	}
	//编辑
	function adm_edit(title, url, w, h){
		layer_show(title, url, w, h);
	}
	//删除
	function adm_del(obj, id) {
		layer.confirm('确认要删除吗？', function(index) {
			$.ajax({
		      type:"get",
		      async:false,
		       url:"${basePath}/coupon/delete.do?id="+id,
		      dataType:"json",
		      success: function(data){
		    	  if(data == 200){
		    		  layer.msg('已删除!', {
							icon : 1,
							time : 1000
						});
						location.replace(location.href);
		    	  }else{
		    		  layer.msg('操作失败,请重试!', {
							icon : 1,
							time : 1000
						});
		    	  }  
		      } 
			});
		});
	}
	</script>
</body>
</html>